// 虚线
import 'package:flutter/material.dart';

class DashLine extends StatelessWidget {
  // 虚线方向
  final Axis axis;

  // 单个虚线宽度
  final double dashWidth;

  // 单个虚线高度
  final double dashHeight;

  // 虚线颜色
  final Color color;

  // 单个虚线总数
  final int count;

  DashLine(
      {this.axis = Axis.horizontal,
      this.dashWidth = 1,
      this.dashHeight = 1,
      this.color = Colors.red,
      this.count});

  @override
  Widget build(BuildContext context) {
    return Flex(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      direction: this.axis,
      children: List.generate(this.count, (_) {
        return SizedBox(
          width: this.dashWidth,
          height: this.dashHeight,
          child: DecoratedBox(
            decoration: BoxDecoration(color: this.color),
          ),
        );
      }),
    );
  }
}
